package com.ice.work.moment.ticket.dao.cookie;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ice.work.moment.facade.ticket.model.Cookie;
import org.springframework.stereotype.Repository;

/**
 * @Description Cookie dao
 * @Author DELL
 * @Create 2019-01-10
 * @Since 1.0.0
 */
@Repository
public class CookieRepository extends ServiceImpl<ICookieMapper, Cookie> implements ICookieRepository {


    @Override
    public Cookie findByLoginNameAndDataStatus(String loginName,Integer dataStatus){
        return this.baseMapper.selectOne(new QueryWrapper<Cookie>().lambda().eq(Cookie::getLoginName,loginName).eq(Cookie::getDataStatus, dataStatus));
    }

    @Override
    public Cookie findByAppKeyAndDataStatus(String appKey, Integer dataStatus) {
        return this.baseMapper.selectOne(new QueryWrapper<Cookie>().lambda().eq(Cookie::getAppKey,appKey).eq(Cookie::getDataStatus, dataStatus));
    }

    @Override
    public int deleteByAppKey(String appKey) {
        return  this.baseMapper.delete(new QueryWrapper<Cookie>().lambda().eq(Cookie::getAppKey,appKey));
    }
}


